package com.woniu.rabbit.dlx_model.consumer;

import com.woniu.rabbit.dlx_model.exchange.DlxDirectConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

@Component
@Slf4j
public class DlxConsumer {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    @RabbitListener(queues = DlxDirectConfig.DLX_DIRECT_QUEUE)
    public void dlxConsumer(String msg) {
        log.info("dlxConsumer接收到消息：{},当前时间：{}", msg, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));

    }
}
